package edu.hcnu.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: Administrator
 * @time: 2022/9/21 14:27
 */
@Data
@AllArgsConstructor
public class Person implements InitializingBean, DisposableBean {
    private Integer id;
    private String name;
    private String gender;
    private Date birthday;
    private List<String> bobbies;
    private Map<Integer, String> course;
    private Wife wife;

    public Person() {
        System.out.println("person 初始化加载");
    }

    public static Person createPersonFactory() {
        Child child = new Child();
        child.setName("儿子");
        return child;
    }

    @Override
    public void destroy() {
        System.out.println("销毁bean 接口回调");
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("实例化bean 接口回调");
    }

    public void destroyByConfig() {
        System.out.println("销毁bean config回调");
    }

    public void initByConfig() throws Exception {
        System.out.println("实例化bean config 回调");
    }
}
